import {
	get,
	post,
  downloadFile
} from './request.js'


// API接口汇总
// 通用接口
export const passwordLogin = (p) => post('/user/api/v1/login', p);  // 密码登录
export const changeUserPassword = (p) => post('/user/api/v1/changeUserPassword', p);  // 更改密码
export const codeImage = () => get('/code/api/v1/getVerificationCode');  // 图形验证码
export const uploadImage = (p) => post('/upload/api/v1/image', p);  // 上传图片
export const uploadExcel = (p) => post('/upload/api/v1/excel', p);  // 上传Excel表格

// 个人中心
export const getCurrentUserInfo = p => get('/userDetail/api/v1/getCurrentUserInfo', p);  // 获取当前用户信息 个人中心
export const editCurrentUserInfo = p => post('/userDetail/api/v1/editCurrentUserInfo', p);  // 编辑取当前用户信息 个人中心

// 用户管理
export const getAllUserInfo = (p,q) => get('/userDetail/api/v1/getAllUserInfo', Object.assign(p,q));  // 根据分页 获取当前页 用户信息
export const getUserInfoByUserDetailId = p => get('/userDetail/api/v1/getUserInfoByUserDetailId/' + p); // 查看某个用户详情
export const createUserInfo = p => post('/userDetail/api/v1/createUserInfo', p);  // 创建用户
export const updateUserInfo = p => post('/userDetail/api/v1/updateUserInfo', p);  // 更新用户
export const deleteUserByUserId = p => get('/user/api/v1/deleteUserByUserId/' + p);  // 删除用户
export const enableUserStatus = p => get('/user/api/v1/enableUserStatus/'+ p);  // 启用用户
export const accountNonLockedUserStatus = p => get('/user/api/v1/accountNonLockedUserStatus/'+ p);  // 锁定账户
export const checkUsername = (p,q) => get('/user/api/v1/checkUsername?username=' + p + '&' + 'userId=' + q);  // 检测用户名重复
export const exportUserInfo = (p) => downloadFile('/userDetail/api/v1/exportUserInfo' , p);  // 导出用户

// 菜单管理
export const getMenuTree = p => get('/menu/api/v1/getMenuTree', p);  // 获取菜单信息User
export const getUserMenuTree = () => get('/menu/api/v1/getUserMenuTree');  // 获取用户菜单信息
export const createMenu = p => post('/menu/api/v1/createMenu', p);  // 创建菜单
export const findOne = p => get('/menu/api/v1/findOne/' + p);  // 通过id找到内容
export const updateMenu = p => post('/menu/api/v1/updateMenu', p);  // 更新菜单
export const moveMenu = p => post('/menu/api/v1/moveMenu', p);  // 移动菜单
export const deleteMenuById = p => get('/menu/api/v1/deleteMenuById/' + p);  // 删除菜单
export const checkRouteName = (p,q) => get('/menu/api/v1/checkRouteName?routeName=' + p + '&' + 'id=' + q);  // 检测路由名称重复
export const checkTitleName = (p,q) => get('/menu/api/v1/checkTitleName?titleName=' + p + '&' + 'id=' + q);  // 检测标题名称重复

// 角色管理
export const getAllRole = p => get('/role/api/v1/getAllRole', p);  // 获取用户角色信息
export const getRole = p => get('/role/api/v1/getRole/' + p);  // 获取用户角色信息
export const createRole = p => post('/role/api/v1/createRole', p);  // 添加角色
export const updateRole = p => post('/role/api/v1/updateRole', p);  // 更新角色
export const deleteRole = p => get('/role/api/v1/deleteRole/' + p);  // 删除角色
export const checkRoleName = (p,q) => get('/role/api/v1/checkRoleName?roleName=' + p + '&' + 'id=' + q);  // 删除角色

// 日志管理
export const getLoginLog = (p,q) => get('/log/api/v1/login/findListByPage', Object.assign(p,q));  // 获取登录日志
export const exportLoginLog = p => downloadFile('/log/api/v1/login/exportLoginLog' , p);  // 导出登录日志
export const getOperationLog = (p,q) => get('/log/api/v1/operation/findListByPage', Object.assign(p,q));  // 获取操作日志
export const exportOperationLog = p => downloadFile('/log/api/v1/operation/exportOperationLog' , p);  // 导出操作日志

// 字典管理
export const addDict = (p) => post('/quick/api/v1/dict/add', p);  // 添加字典
export const deleteDict = (p) => get('/quick/api/v1/dict/delete/' + p);  // 删除字典
export const updateDict = (p) => post('/quick/api/v1/dict/update', p);  // 更新字典
export const findListByTreeDict = (p) => get('/quick/api/v1/dict/findListByTree', p);  // 查询字典树
export const findListByPageDict = (p,q) => get('/quick/api/v1/dict/findListByPage', Object.assign(p,q));  // 分页查询
export const findByIdDict = (p) => get('/quick/api/v1/dict/findById/' + p);  // 查询某一个字典

// 代码模型管理
export const addCodeModel = (p) => post('/quick/api/v1/codeModel/add', p);  // 添加代码模型
export const deleteCodeModel = (p) => get('/quick/api/v1/codeModel/delete/' + p);  // 删除代码模型
export const updateCodeModel = (p) => post('/quick/api/v1/codeModel/update', p);  // 更新代码模型
export const findListByPageCodeModel = (p,q) => get('/quick/api/v1/codeModel/findListByPage', Object.assign(p,q));  // 分页查询
export const findByIdCodeModel = (p) => get('/quick/api/v1/codeModel/findById/' + p);  // 查询某一个代码模型
export const exportCodeModelInfo = p => downloadFile('/quick/api/v1/codeModel/exportCodeModelInfo' , p);  // 导出代码模型
export const enableCodeModel = (p) => get('/quick/api/v1/codeModel/enableCodeModel/' + p);  // 启用与禁用代码模型
export const checkCodeType = (p,q) => get('/quick/api/v1/codeModel/checkCodeType?codeType=' + p + '&' + 'id=' + q);  // 检查代码标识
export const checkCodeName = (p,q) => get('/quick/api/v1/codeModel/checkCodeName?codeName=' + p + '&' + 'id=' + q);  // 检查代码名称
export const getCodeCorrDictList = p => get('/quick/api/v1/codeModel/getCodeCorrDictList',p);  // 获得代码模型数据
export const compileRun = p => post('/quick/api/v1/codeModel/compileRun',p);  // 编译验证